package AJava1月.EJava第五周.练习题02;

import java.util.Random;
import java.util.Scanner;

public class D猜奖 {
    public static void main(String[] args) {
        Random r = new Random();

        int number = r.nextInt(100) + 1;
        System.out.println(number);
        //打印出来随机数


          int count = 0;
        Scanner sc = new Scanner(System.in);
        while (true){
            System.out.println("请输入您要猜的数字");

            int guessNumber = sc.nextInt();
             count++;
            if (count == 3){
                System.out.println("恭喜您猜中了");
                break;
            }else if(number < guessNumber){
                System.out.println("猜大了");
            }else if(number > guessNumber){
                System.out.println("猜小了");
            }else {
                System.out.println("猜中了");
                break;
            }
        }
    }
    }
